package com.quanquan.resource.service;

import com.quanquan.resource.configBeans.RabbitSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class TimerService {

    @Autowired
    private RabbitSender rabbitSender;


    @Scheduled(cron = "0 0/3 * * *  ?")
    public void sendSystemLog() {

        //发送消息推送
        Map<String, Object> properties = new HashMap<>();



        //将计算结果放到MQ队列去补充明细的余额
        String msg = "启动定时器";
        String exchange = "timer.exchange";
        String routingKey = "timerShoppingKill.message";
        rabbitSender.sendMessageToMQ(msg, properties, exchange, routingKey);
    }


    @Scheduled(cron = "0 0/3 * * *  ?")
    public void sendSystemLog2() {

        //发送消息推送
        Map<String, Object> properties = new HashMap<>();

        //将计算结果放到MQ队列去补充明细的余额
        String msg = "启动定时器";
        String exchange = "groupBuying.exchange";
        String routingKey = "groupBuying.message";
        rabbitSender.sendMessageToMQ(msg, properties, exchange, routingKey);
    }
}
